/**
 * @author wl
 * 调用方法获取机型
 * @date 2018-11-4
 */
export const mobileModel = () => {
  return new Promise((resolve, reject) => {
    wx.getSystemInfo({
      success (res) {
        if (res.platform === "ios") {
          resolve(true)
        } else {
          resolve(false)
        }
      }
    })
  })
}

/**
 * @author wl
 * 验证手机号
 * @date 2018-11-4
 */
export const testPhone = (phone, val) => {
  if (!(/^1[345789]\d{9}$/.test(phone))) {
    if (phone.length > 0) {
     !val?wx.showToast({ title: '手机号输入错误', icon: "none" }):''
      return false
    }
  } else {
    return true
  }
}
/**
 * @author 王磊
 * 填写跟进组织数据
 * @date 2019-3-18
 */
export const describeData = (router, res, point, tabIndex) => {
  // 汇集数据
  let model = {
    callId: res.result.callId, // 赋值callid
    resourceCode: res.result.resourceCode, // 房客编号
    page: router, // 拨打电话目录
    utype: res.result.utype, // 房客
    swindex: tabIndex ? tabIndex : '',
    id:res.result.id
  }
  // 是否填写遗留跟进
  if (point) {
    // 提示跳转
    wx.showToast({
      title: '您有跟进尚未填写, 稍后进入跟进页面',
      icon: 'none',
      success() {
        setTimeout(() => {
          wx.redirectTo({
            url: `../follow_describe/index?model=${JSON.stringify(model)}`
          })
        }, 1500)
      }
    })
  } else {
    wx.redirectTo({
      url: `../follow_describe/index?model=${JSON.stringify(model)}`
    })
  }
}